﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Presentation;

namespace WindowsFormsView
{
    public partial class Form1 : Form
    {
        object mainViewModel;
        public Form1(object mainViewModel)
        {
            this.mainViewModel = mainViewModel;
            InitializeComponent();
            textBox1.DataBindings.Add(new Binding("Text", mainViewModel, "FromValue", true, DataSourceUpdateMode.OnPropertyChanged));
            textBox2.DataBindings.Add(new Binding("Text", mainViewModel, "ToValue"));
            comboBox1.DataSource = new BindingSource(mainViewModel, "FromTypes");
            comboBox1.DataBindings.Add(new Binding("SelectedItem", mainViewModel, "FromType", true, DataSourceUpdateMode.OnPropertyChanged));
            comboBox2.DataSource = new BindingSource(mainViewModel, "ToTypes");
            comboBox2.DataBindings.Add(new Binding("SelectedItem", mainViewModel, "ToType", true, DataSourceUpdateMode.OnPropertyChanged));
            richTextBox1.DataBindings.Add(new Binding("Text", mainViewModel, "Log", true, DataSourceUpdateMode.OnPropertyChanged));
        }
    }
}
